import request from '@/libs/http/index'

// 获取权限菜单
export function getRoutersApi(params) {
  return request({
    url: '/menu/router',
    method: 'GET',
    params
  })
}

// list
export function getMenuApi(params) {
  return request({
    url: '/menu',
    method: 'GET',
    params
  })
}

// create
export function addMenuApi(data) {
  return request({
    url: '/menu',
    method: 'POST',
    data
  })
}

export function updateMenuApi(data) {
  return request({
    url: '/menu',
    method: 'PATCH',
    data
  })
}

export function delMenuApi(id) {
  return request({
    url: `/menu/${id}`,
    method: 'DELETE'
  })
}

export function detailMenuApi(id) {
  return request({
    url: `/menu/${id}`,
    method: 'GET'
  })
}

// 菜单是否显示
export function changeDisplayApi(id,status){
  return request({
    url: `/menu/display/${id}/${status}`,
    method:'PATCH'
  })
}


// 获取菜单树
export function getMenuTreeApi(){
  return request({
    url: `/menu/tree`,
    method:'GET'
  })
}

